﻿<UserControl x:Class="Sautom.Modules.Client.Views.ClientFileList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:res="clr-namespace:Sautom.I18N;assembly=Sautom.I18N" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="250*" />
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <!--<MenuItem Header="Back to client's details" 
                      Command="{Binding BackCommand}" />-->
            <MenuItem Header="{Binding Source={x:Static res:ClientResources.UploadNewFileBtn}}" 
                      Command="{Binding UploadFileCommand}" />
        </Menu>        
        <ListBox Grid.Row="1" ItemsSource="{Binding Files}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <DockPanel>
                            <TextBlock Text="{Binding Path=Value}" Margin="0,0,15,0" Width="160" />
                            <Button DockPanel.Dock="Right" Width="Auto" Margin="10,0,10,0" Command="{Binding DataContext.DeleteFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" CommandParameter="{Binding Id}">
                                <Image Source="..\Images\trash.png" />
                            </Button>
                            <Button DockPanel.Dock="Right" Width="30" Command="{Binding DataContext.DownloadFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}}" CommandParameter="{Binding Id}">
                                <Image Source="..\Images\open.png" />
                            </Button>
                        </DockPanel>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</UserControl>
